// 文件路径: com.city.java.feedbacks.controller.FeedbackProcessingController.java
package com.city.java.feedbacks.controller;

import com.city.java.base.response.JsonResult;
import com.city.java.feedbacks.pojo.entity.FeedbackProcessing;
import com.city.java.feedbacks.service.FeedbackProcessingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 意见反馈处理控制器
 */
@Slf4j
@Api(tags = "03.意见反馈处理模块")
@RestController
@RequestMapping("/api/feedbacks/processing")
public class FeedbackProcessingController {

    @Autowired
    private FeedbackProcessingService feedbackProcessingService;

    /**
     * 添加反馈处理记录
     */
    @PostMapping("/add")
    @ApiOperation(value = "添加反馈处理记录", notes = "添加新的反馈处理信息")
    public JsonResult addFeedbackProcessing(
            @ApiParam(value = "反馈处理信息", required = true)
            @RequestBody FeedbackProcessing feedbackProcessing) {
        log.info("接收到添加反馈处理记录请求: {}", feedbackProcessing);
        return feedbackProcessingService.addFeedbackProcessing(feedbackProcessing);
    }

    /**
     * 根据处理ID查询反馈处理记录
     */
    @GetMapping("/select/id/{processingId}")
    @ApiOperation(value = "根据ID查询反馈处理记录", notes = "根据处理ID查询反馈处理详细信息")
    public JsonResult getFeedbackProcessingById(
            @ApiParam(value = "处理ID", required = true, example = "1")
            @PathVariable Long processingId) {
        log.info("接收到根据ID查询反馈处理记录请求: ID={}", processingId);
        return feedbackProcessingService.getFeedbackProcessingById(processingId);
    }

    /**
     * 根据反馈ID查询反馈处理记录
     */
    @GetMapping("/select/feedback/{feedbackId}")
    @ApiOperation(value = "根据反馈ID查询处理记录", notes = "根据反馈ID查询处理记录")
    public JsonResult getFeedbackProcessingByFeedbackId(
            @ApiParam(value = "反馈ID", required = true, example = "1")
            @PathVariable Long feedbackId) {
        log.info("接收到根据反馈ID查询处理记录请求: feedbackId={}", feedbackId);
        return feedbackProcessingService.getFeedbackProcessingByFeedbackId(feedbackId);
    }

    /**
     * 根据状态查询反馈处理列表
     */
    @GetMapping("/select/status/{status}")
    @ApiOperation(value = "根据状态查询反馈处理记录", notes = "根据状态查询反馈处理列表")
    public JsonResult getFeedbackProcessingsByStatus(
            @ApiParam(value = "状态", required = true, example = "pending")
            @PathVariable String status) {
        log.info("接收到根据状态查询反馈处理记录请求: status={}", status);
        return feedbackProcessingService.getFeedbackProcessingsByStatus(status);
    }

    /**
     * 查询所有反馈处理列表
     */
    @GetMapping("/quarry")
    @ApiOperation(value = "查询所有反馈处理记录", notes = "查询所有反馈处理列表")
    public JsonResult getAllFeedbackProcessings() {
        log.info("接收到查询所有反馈处理记录请求");
        return feedbackProcessingService.getAllFeedbackProcessings();
    }

    /**
     * 根据处理ID删除反馈处理记录
     */
    @DeleteMapping("/delete/id/{processingId}")
    @ApiOperation(value = "根据ID删除反馈处理记录", notes = "根据处理ID删除反馈处理记录")
    public JsonResult deleteFeedbackProcessingById(
            @ApiParam(value = "处理ID", required = true, example = "1")
            @PathVariable Long processingId) {
        log.info("接收到根据ID删除反馈处理记录请求: ID={}", processingId);
        return feedbackProcessingService.deleteFeedbackProcessingById(processingId);
    }

    /**
     * 更新反馈处理信息
     */
    @PutMapping("/update")
    @ApiOperation(value = "更新反馈处理信息", notes = "更新反馈处理详细信息")
    public JsonResult updateFeedbackProcessing(
            @ApiParam(value = "反馈状态", required = false)
            @RequestParam(required = false) String feedbackStatus,
            @ApiParam(value = "反馈处理信息", required = true)
            @RequestBody FeedbackProcessing feedbackProcessing) {
        log.info("接收到更新反馈处理信息请求: {}, status={}", feedbackProcessing, feedbackStatus);
        return feedbackProcessingService.updateFeedbackProcessing(feedbackProcessing, feedbackStatus);
    }
}
